// src/api/modules/product.js
import request from '@/utils/request'

export const productAPI = {
  // 获取产品列表
  getList: (params) => request.get('/products', { params }),
  
  // 创建产品
  create: (data) => request.post('/products', data),
  
  // 更新产品
  update: (id, data) => request.put(`/products/${id}`, data),
  
  // 删除产品
  delete: (id) => request.delete(`/products/${id}`),
  
  // 获取产品详情
  getDetail: (id) => request.get(`/products/${id}`),
  
  // 批量删除产品
  batchDelete: (ids) => request.delete('/products/batch', { data: { ids } }),
  
  // 上架/下架产品
  toggleStatus: (id, status) => request.patch(`/products/${id}/status`, { status }),
  
  // 获取产品分类
  getCategories: () => request.get('/product-categories')
}